/*** server ***/
package util;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;

public class Utils {

    public static void setServerAttributes() {
        try {
            BufferedReader in = new BufferedReader(new FileReader("server.stats"));
            String str;
            String[] s;
            int fase = 0;
            boolean complete = false;
            while (!complete && in.ready()) {
                str = in.readLine();
                if (str.startsWith("#")) {
                    continue;
                }
                s = str.split(" ");
                main.Main.setWeight(fase, Integer.parseInt(s[0]));
                main.Main.setServer(fase, s[1]);
                main.Main.setState(fase, 0);
                fase++;
            }
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static String[][] listToArray(List<String[]> list) {
        String[][] res = new String[list.size()][list.get(0).length];
        for (int i = 0; i < list.size(); i++) {
            res[i] = list.get(i);
        }
        return res;
    }
}
